<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/whnk/css/whnk-ui.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<style>
    .droppable-active{background-color:#ffe!important}.tools a{cursor:pointer;font-size:80%}.form-body .col-md-6,.form-body .col-md-12{min-height:400px}.draggable{cursor:move}
</style>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-environment-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">项目名称：</label>
				<div class="col-sm-8">
					<!-- <input id="prjNm" name="prjNm" class="form-control" type="text"> -->
					<select id="prjNm" name="prjNm" class="form-control" th:with="proList=${@prgm.getProList()}">
					<option>请选择</option>
					<option th:each="prgm : ${proList}" th:text="${prgm.prgName}" th:value="${prgm.prgName}"></option>					
					</select>
				</div>
			</div>
			
			<div class="form-group">	
				<label class="col-sm-3 control-label">版本日期：</label>
				<div class="col-sm-8">
					<select id="vrsnDt" name="vrsnDt" class="form-control">
					<option>请选择</option>
					</select>
				</div>
			</div> 
			
<!-- 			<div class="form-group">	
				<label class="col-sm-3 control-label">版本日期：</label>
				<div class="col-sm-8">
					<select id="vrsnDt" name="vrsnDt" class="form-control" th:with="dateList=${@prgm.getProDate('一月开发流')}" onmousedown="setParame()">
					<option>请选择</option>
					<option th:each="prgm : ${dateList}" th:text="${prgm.prgDate}" th:value="${prgm.prgDate}"></option>	
					</select>
				</div>
			</div> -->
			<div class="form-group">	
				<label class="col-sm-3 control-label">开发流名称：</label>
				<div class="col-sm-8">
					<!-- <input id="dvlpstrmNm" name="dvlpstrmNm" class="form-control" type="text"> -->
					<select id="dvlpstrmNm" name="dvlpstrmNm" class="form-control">
					<option>请选择</option>
					</select>
				</div>
			</div>
<!--  			<div class="form-group">	
				<label class="col-sm-3 control-label">版本日期：</label>
				<div class="col-sm-8">
					<input id="vrsnDt" name="vrsnDt" class="form-control" type="text">
			    			<div class="input-group date">
			    				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
			         			<input id="vrsnDt" name="vrsnDt" type="text" class="form-control">
			    			</div>
				</div>
			</div>  -->
<!-- 			<div class="form-group">	
				<label class="col-sm-3 control-label">版本日期：</label>
				<div class="col-sm-8">
					<div class="input-group date">
			    	<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
					<input id="vrsnDt" name="vrsnDt" class="form-control" type="text">
					</div>
				</div>
			</div>  -->

			<div class="form-group">	
				<label class="col-sm-3 control-label">部署单元：</label>
				<div class="col-sm-8">
					<input id="relsUit" name="relsUit" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">版本机IP：</label>
				<div class="col-sm-8">
					<input id="vrsnIp" name="vrsnIp" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">服务启动端口：</label>
				<div class="col-sm-8">
					<input id="serstrPort" name="serstrPort" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">目标版本包：</label>
				<div class="col-sm-8">
					<input id="tagvrsnPag" name="tagvrsnPag" class="form-control" type="text">
				</div>
			</div>
 	    	<div class="form-group">	
				<label class="col-sm-3 control-label">目标版本包路径：</label>
				<div class="col-sm-8">
					<input id="tagvrsnPagRte" name="tagvrsnPagRte" class="form-control" type="text">
				</div>
			</div> 
			<div class="form-group">	
				<label class="col-sm-3 control-label">是否在自动版本中生效(0:生效 1:未生效)：</label>
				<div class="col-sm-8">
					<!-- <input id="valid" name="valid" class="form-control" type="text"> -->
					<select id="valid" name="valid" class="form-control" th:with="type=${@dict.getType('valid')}">
					<option>请选择</option>
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
					</select>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
    <script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
    <script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
    <script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
    <script >
    $(".input-group.date").datepicker({todayBtn: "linked",keyboardNavigation: !1,forceParse: !1,calendarWeeks: !0,autoclose: !0});
    </script> 
    <script type="text/javascript">
		var prefix = ctx + "system/environment"
		$("#form-environment-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-environment-add').serialize());
	        }
	    }
	</script> 
	<script type="text/javascript">
	$(document).ready(function(){
        $("#prjNm").change(function() {
           var prefix = ctx + "system/environment";
           var option = $(this).find("option:selected");
           var value = option.val();
		   $.ajax({
			   cache:true,
			   type:"get",
			   url:prefix+"/selectD",
			   data:{"val":value},
			   success:function(data){
				   var arr = data.datas;
				   var vrsnDtID = $("#vrsnDt").empty();
				   vrsnDtID.append("<option value='请选择'>请选择</option>");
				   for(var i=0;i<data.datas.length;i++){
					   var proNam = arr[i].prgDate;
					   vrsnDtID.append("<option value='" + proNam + "'>" + proNam + "</option>");
				   }
			   },
			   error:function(error){
				   notifyError("获取日期失败");
			   }
		   });
       });
        
        $("#vrsnDt").change(function(){
            var prefix = ctx + "system/environment";
        	var optionName = $("#prjNm").find("option:selected").val();
        	var optionDate = $(this).find("option:selected").val();
        	$.ajax({
 			   cache:true,
			   type:"get",
			   url:prefix+"/selectNd",
			   data:{"val":optionName,"nam":optionDate},
			   success:function(data){
				   var dvlpstrmNmID = $("#dvlpstrmNm").empty();
				   var arr = data.dataL;
				   dvlpstrmNmID.append("<option value='请选择'>请选择</option>");
				   for(var i=0;i<data.dataL.length;i++){
					   var devName = arr[i].devName;
					   dvlpstrmNmID.append("<option value='" + devName + "'>" + devName + "</option>");
				   }
			   },
			   error:function(error){
				   notifyError("获取开发流失败");
			   }
        	});
        });
	});
	</script>
</body>
</html>
